import { InbizIcon } from '@inbiz/utils';
import { TextWidget } from '@inbiz/react';
import { processState } from '../../../commonUtils';
import '../index.less';

export default function CardTitle(props: { data: any; choosedTabKey: any; }) {
  const { data, choosedTabKey } = props;
  const { processName, urgeState, taskState } = data;

  return (
    <div>
      <span className={'processTitle'}>{processName}</span>{' '}
      {(urgeState === 0 || urgeState === 250) &&
        (choosedTabKey == '2' || choosedTabKey == '3' || choosedTabKey == '6') && (
          <InbizIcon
            style={{
              fontSize: 12,
              marginLeft: 15,
            }}
            type="icon-a-zu2259"
          />
        )}
      <span
        className={'cardTitle'}
        style={{
          background: processState[taskState] ? processState[taskState].stateBgColor : '#ccc',
          color: processState[taskState] ? processState[taskState].stateFontColor : '#fff',
        }}
      >
        <TextWidget>{processState[taskState] ? processState[taskState].stateName : ''}</TextWidget>
      </span>
    </div>
  );
}
